package com.mc.mcgoweb.utils.convert;


import org.springframework.beans.BeanUtils;

/**
 * @author zhangyu
 * @Description 转化类
 * @date 2018/7/10 0010 下午 14:43
 */
public class VoConver {


    public static <T> T convert(VoCallBack<T> vo) {
        return vo.invoke();
    }

    public static <T, V> T defaultConvert(final T t, final V v) {

        return convert(new VoCallBack<T>() {
            @Override
            public T invoke() {
                if (v == null) return null;
                BeanUtils.copyProperties(v, t);
                return t;
            }

        });
    }
}
